3.3.59 \(\int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx\) [259]

3.3.59.1 Optimal result
3.3.59.2 Mathematica [A] (verified)
3.3.59.3 Rubi [A] (verified)
3.3.59.4 Maple [A] (verified)
3.3.59.5 Fricas [A] (verification not implemented)
3.3.59.6 Sympy [F]
3.3.59.7 Maxima [F(-2)]
3.3.59.8 Giac [A] (verification not implemented)
3.3.59.9 Mupad [B] (verification not implemented)

3.3.59.1 Optimal result

Integrand size = 26, antiderivative size = 219 \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {2 b^4 \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a (a-b)^{5/2} (a+b)^{5/2} d}+\frac {2 b^2 \left (3 a^2-b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a (a-b)^{5/2} (a+b)^{5/2} d}-\frac {\sin (c+d x)}{2 (a+b)^2 d (1-\cos (c+d x))}-\frac {\sin (c+d x)}{2 (a-b)^2 d (1+\cos (c+d x))}-\frac {b^3 \sin (c+d x)}{\left (a^2-b^2\right )^2 d (b+a \cos (c+d x))} \]

output
2*b^4*arctanh((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b)^(1/2))/a/(a-b)^(5/2)/(a 
+b)^(5/2)/d+2*b^2*(3*a^2-b^2)*arctanh((a-b)^(1/2)*tan(1/2*d*x+1/2*c)/(a+b) 
^(1/2))/a/(a-b)^(5/2)/(a+b)^(5/2)/d-1/2*sin(d*x+c)/(a+b)^2/d/(1-cos(d*x+c) 
)-1/2*sin(d*x+c)/(a-b)^2/d/(1+cos(d*x+c))-b^3*sin(d*x+c)/(a^2-b^2)^2/d/(b+ 
a*cos(d*x+c))
 
3.3.59.2 Mathematica [A] (verified)

Time = 1.83 (sec) , antiderivative size = 131, normalized size of antiderivative = 0.60 \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {-\frac {12 a b^2 \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2}}+\frac {\left (-3 b^3-2 a \left (a^2-b^2\right ) \cos (c+d x)+\left (2 a^2 b+b^3\right ) \cos (2 (c+d x))\right ) \csc (c+d x)}{b+a \cos (c+d x)}}{2 (a-b)^2 (a+b)^2 d} \]

input
Integrate[Cos[c + d*x]/(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
 
output
((-12*a*b^2*ArcTanh[((-a + b)*Tan[(c + d*x)/2])/Sqrt[a^2 - b^2]])/Sqrt[a^2 
 - b^2] + ((-3*b^3 - 2*a*(a^2 - b^2)*Cos[c + d*x] + (2*a^2*b + b^3)*Cos[2* 
(c + d*x)])*Csc[c + d*x])/(b + a*Cos[c + d*x]))/(2*(a - b)^2*(a + b)^2*d)
 
3.3.59.3 Rubi [A] (verified)

Time = 0.68 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3042, 4897, 3042, 25, 3376, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2}dx\)

\(\Big \downarrow \) 4897

\(\displaystyle \int \frac {\cos (c+d x) \cot ^2(c+d x)}{(a \cos (c+d x)+b)^2}dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int -\frac {\sin \left (c+d x-\frac {\pi }{2}\right )^3}{\cos \left (c+d x-\frac {\pi }{2}\right )^2 \left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )^2}dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \frac {\sin \left (\frac {1}{2} (2 c-\pi )+d x\right )^3}{\cos \left (\frac {1}{2} (2 c-\pi )+d x\right )^2 \left (b-a \sin \left (\frac {1}{2} (2 c-\pi )+d x\right )\right )^2}dx\)

\(\Big \downarrow \) 3376

\(\displaystyle -\int \left (-\frac {b^3}{a \left (b^2-a^2\right ) (b+a \cos (c+d x))^2}-\frac {1}{2 (a-b)^2 (-\cos (c+d x)-1)}-\frac {1}{2 (a+b)^2 (1-\cos (c+d x))}+\frac {3 a^2 b^2-b^4}{a \left (a^2-b^2\right )^2 (-b-a \cos (c+d x))}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {2 b^2 \left (3 a^2-b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d (a-b)^{5/2} (a+b)^{5/2}}-\frac {b^3 \sin (c+d x)}{d \left (a^2-b^2\right )^2 (a \cos (c+d x)+b)}+\frac {2 b^4 \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{a d (a-b)^{5/2} (a+b)^{5/2}}-\frac {\sin (c+d x)}{2 d (a+b)^2 (1-\cos (c+d x))}-\frac {\sin (c+d x)}{2 d (a-b)^2 (\cos (c+d x)+1)}\)

input
Int[Cos[c + d*x]/(a*Sin[c + d*x] + b*Tan[c + d*x])^2,x]
 
output
(2*b^4*ArcTanh[(Sqrt[a - b]*Tan[(c + d*x)/2])/Sqrt[a + b]])/(a*(a - b)^(5/ 
2)*(a + b)^(5/2)*d) + (2*b^2*(3*a^2 - b^2)*ArcTanh[(Sqrt[a - b]*Tan[(c + d 
*x)/2])/Sqrt[a + b]])/(a*(a - b)^(5/2)*(a + b)^(5/2)*d) - Sin[c + d*x]/(2* 
(a + b)^2*d*(1 - Cos[c + d*x])) - Sin[c + d*x]/(2*(a - b)^2*d*(1 + Cos[c + 
 d*x])) - (b^3*Sin[c + d*x])/((a^2 - b^2)^2*d*(b + a*Cos[c + d*x]))
 

3.3.59.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3376
Int[cos[(e_.) + (f_.)*(x_)]^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) 
 + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Int[ExpandTrig[(d*sin[ 
e + f*x])^n*(a + b*sin[e + f*x])^m*(1 - sin[e + f*x]^2)^(p/2), x], x] /; Fr 
eeQ[{a, b, d, e, f}, x] && NeQ[a^2 - b^2, 0] && IntegersQ[m, 2*n, p/2] && ( 
LtQ[m, -1] || (EqQ[m, -1] && GtQ[p, 0]))
 

rule 4897
Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]
 
3.3.59.4 Maple [A] (verified)

Time = 1.37 (sec) , antiderivative size = 155, normalized size of antiderivative = 0.71

method result size
derivativedivides \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a^{2}-2 a b +b^{2}\right )}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b^{2} \left (-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b}-\frac {3 a \,\operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) \(155\)
default \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a^{2}-2 a b +b^{2}\right )}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 b^{2} \left (-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b}-\frac {3 a \,\operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) \(155\)
risch \(-\frac {2 i \left (a^{4} {\mathrm e}^{3 i \left (d x +c \right )}+a^{2} b^{2} {\mathrm e}^{3 i \left (d x +c \right )}+b^{4} {\mathrm e}^{3 i \left (d x +c \right )}+3 a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+a^{4} {\mathrm e}^{i \left (d x +c \right )}-3 a^{2} b^{2} {\mathrm e}^{i \left (d x +c \right )}-b^{4} {\mathrm e}^{i \left (d x +c \right )}-2 a^{3} b -a \,b^{3}\right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )} a +2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right ) \left (a^{2}-b^{2}\right )^{2} a \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) d}+\frac {3 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {3 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}\) \(346\)

input
int(cos(d*x+c)/(sin(d*x+c)*a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)
 
output
1/d*(-1/2*tan(1/2*d*x+1/2*c)/(a^2-2*a*b+b^2)-1/2/(a+b)^2/tan(1/2*d*x+1/2*c 
)-2*b^2/(a-b)^2/(a+b)^2*(-b*tan(1/2*d*x+1/2*c)/(tan(1/2*d*x+1/2*c)^2*a-tan 
(1/2*d*x+1/2*c)^2*b-a-b)-3*a/((a+b)*(a-b))^(1/2)*arctanh(tan(1/2*d*x+1/2*c 
)*(a-b)/((a+b)*(a-b))^(1/2))))
 
3.3.59.5 Fricas [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 518, normalized size of antiderivative = 2.37 \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\left [-\frac {2 \, a^{4} b + 2 \, a^{2} b^{3} - 4 \, b^{5} - 3 \, {\left (a^{2} b^{2} \cos \left (d x + c\right ) + a b^{3}\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) \sin \left (d x + c\right ) - 2 \, {\left (2 \, a^{4} b - a^{2} b^{3} - b^{5}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (d x + c\right )}{2 \, {\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}, -\frac {a^{4} b + a^{2} b^{3} - 2 \, b^{5} - 3 \, {\left (a^{2} b^{2} \cos \left (d x + c\right ) + a b^{3}\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - {\left (2 \, a^{4} b - a^{2} b^{3} - b^{5}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (d x + c\right )}{{\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}\right ] \]

input
integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="fricas")
 
output
[-1/2*(2*a^4*b + 2*a^2*b^3 - 4*b^5 - 3*(a^2*b^2*cos(d*x + c) + a*b^3)*sqrt 
(a^2 - b^2)*log((2*a*b*cos(d*x + c) - (a^2 - 2*b^2)*cos(d*x + c)^2 + 2*sqr 
t(a^2 - b^2)*(b*cos(d*x + c) + a)*sin(d*x + c) + 2*a^2 - b^2)/(a^2*cos(d*x 
 + c)^2 + 2*a*b*cos(d*x + c) + b^2))*sin(d*x + c) - 2*(2*a^4*b - a^2*b^3 - 
 b^5)*cos(d*x + c)^2 + 2*(a^5 - 2*a^3*b^2 + a*b^4)*cos(d*x + c))/(((a^7 - 
3*a^5*b^2 + 3*a^3*b^4 - a*b^6)*d*cos(d*x + c) + (a^6*b - 3*a^4*b^3 + 3*a^2 
*b^5 - b^7)*d)*sin(d*x + c)), -(a^4*b + a^2*b^3 - 2*b^5 - 3*(a^2*b^2*cos(d 
*x + c) + a*b^3)*sqrt(-a^2 + b^2)*arctan(-sqrt(-a^2 + b^2)*(b*cos(d*x + c) 
 + a)/((a^2 - b^2)*sin(d*x + c)))*sin(d*x + c) - (2*a^4*b - a^2*b^3 - b^5) 
*cos(d*x + c)^2 + (a^5 - 2*a^3*b^2 + a*b^4)*cos(d*x + c))/(((a^7 - 3*a^5*b 
^2 + 3*a^3*b^4 - a*b^6)*d*cos(d*x + c) + (a^6*b - 3*a^4*b^3 + 3*a^2*b^5 - 
b^7)*d)*sin(d*x + c))]
 
3.3.59.6 Sympy [F]

\[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\int \frac {\cos {\left (c + d x \right )}}{\left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2}}\, dx \]

input
integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c))**2,x)
 
output
Integral(cos(c + d*x)/(a*sin(c + d*x) + b*tan(c + d*x))**2, x)
 
3.3.59.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]

input
integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*a^2-4*b^2>0)', see `assume?` f 
or more de
 
3.3.59.8 Giac [A] (verification not implemented)

Time = 0.54 (sec) , antiderivative size = 282, normalized size of antiderivative = 1.29 \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=-\frac {\frac {12 \, {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )} a b^{2}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2} - 2 \, a b + b^{2}} + \frac {a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 5 \, b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{3} + a^{2} b + a b^{2} - b^{3}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}}{2 \, d} \]

input
integrate(cos(d*x+c)/(a*sin(d*x+c)+b*tan(d*x+c))^2,x, algorithm="giac")
 
output
-1/2*(12*(pi*floor(1/2*(d*x + c)/pi + 1/2)*sgn(2*a - 2*b) + arctan((a*tan( 
1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))/sqrt(-a^2 + b^2)))*a*b^2/((a^4 
- 2*a^2*b^2 + b^4)*sqrt(-a^2 + b^2)) + tan(1/2*d*x + 1/2*c)/(a^2 - 2*a*b + 
 b^2) + (a^3*tan(1/2*d*x + 1/2*c)^2 - 3*a^2*b*tan(1/2*d*x + 1/2*c)^2 + 3*a 
*b^2*tan(1/2*d*x + 1/2*c)^2 - 5*b^3*tan(1/2*d*x + 1/2*c)^2 - a^3 + a^2*b + 
 a*b^2 - b^3)/((a^4 - 2*a^2*b^2 + b^4)*(a*tan(1/2*d*x + 1/2*c)^3 - b*tan(1 
/2*d*x + 1/2*c)^3 - a*tan(1/2*d*x + 1/2*c) - b*tan(1/2*d*x + 1/2*c))))/d
 
3.3.59.9 Mupad [B] (verification not implemented)

Time = 23.40 (sec) , antiderivative size = 213, normalized size of antiderivative = 0.97 \[ \int \frac {\cos (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {\frac {a^2-2\,a\,b+b^2}{a+b}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (a^3-3\,a^2\,b+3\,a\,b^2-5\,b^3\right )}{{\left (a+b\right )}^2}}{d\,\left (\left (2\,a^3-6\,a^2\,b+6\,a\,b^2-2\,b^3\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (-2\,a^3+2\,a^2\,b+2\,a\,b^2-2\,b^3\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d\,{\left (a-b\right )}^2}+\frac {6\,a\,b^2\,\mathrm {atanh}\left (\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (a^4-2\,a^2\,b^2+b^4\right )}{{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{3/2}}\right )}{d\,{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{5/2}} \]

input
int(cos(c + d*x)/(a*sin(c + d*x) + b*tan(c + d*x))^2,x)
 
output
((a^2 - 2*a*b + b^2)/(a + b) - (tan(c/2 + (d*x)/2)^2*(3*a*b^2 - 3*a^2*b + 
a^3 - 5*b^3))/(a + b)^2)/(d*(tan(c/2 + (d*x)/2)^3*(6*a*b^2 - 6*a^2*b + 2*a 
^3 - 2*b^3) + tan(c/2 + (d*x)/2)*(2*a*b^2 + 2*a^2*b - 2*a^3 - 2*b^3))) - t 
an(c/2 + (d*x)/2)/(2*d*(a - b)^2) + (6*a*b^2*atanh((tan(c/2 + (d*x)/2)*(a^ 
4 + b^4 - 2*a^2*b^2))/((a + b)^(5/2)*(a - b)^(3/2))))/(d*(a + b)^(5/2)*(a 
- b)^(5/2))